package com.movecar.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.ViewGroup.LayoutParams;
import android.widget.ImageView;

import com.movecar.application.MainApplication;

/**
 * 列表的imageview
 * 
 * @author
 * 
 */
public class ReadingListImageview extends ImageView {

	public final String TAG = ReadingListImageview.class.getSimpleName();

	public ReadingListImageview(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	@Override
	protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
		super.onMeasure(widthMeasureSpec, heightMeasureSpec);
		imageSize();
	}

	/**
	 * 
	 * 高度是宽度的1/2
	 */
	public void imageSize() {
		float width = MainApplication.screenWidthDip;
		LayoutParams para = this.getLayoutParams();
		para.width = (int) (width - 16);
		para.height = (int) (((width - 16) / 2) + 8);
		this.setLayoutParams(para);
	}

}